<template>
  <div>
    <ul>
      <li>{{$t('webchat.trackVideo')}} <i @click="getVideos" class="iconfont icon-liulanguiji"></i></li>
    </ul>
    <!--<track-video v-if="showVideo" @closeVideos="closeVideos"></track-video>-->
    <el-dialog :close-on-click-modal="false"
      modal-append-to-body
      :close-on-press-escape=true
      lock-scroll top="10%"
      class= "dislog-login dislog-browser" :title="$t('public.tip')" :visible.sync="showTrackBrowser">
      <p class="browser_tip">{{$t('login.browserTrackTips1')}}</p>
      <a target="_blank" href="//www.google.cn/intl/zh-CN/chrome/" class="ico icoChrome" :title="$t('login.browserTitle')"></a>
      <div slot="footer" class="dialog-footer">
        <a target="_blank" href="//www.google.cn/intl/zh-CN/chrome/">
          <el-button type="primary" >{{$t('login.browserTip4')}}</el-button>
        </a>
        <el-button @click.native="closeBrowser">{{$t('login.browserTrackTips4')}}</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
  export default {
    name: 'trackLabel',
    data () {
      return {
        showVideo: false,
        showTrackBrowser: false
      }
    },
    methods: {
      getVideos () { // 显示播放的区域
        window._hmt && window._hmt.push(['_trackEvent', '在线咨询', 'PM-浏览轨迹回放'])
        let agent = navigator.userAgent.toLowerCase()
        let browserInfo = agent.match(/chrome\/[\d.]+/gi)
        let verinfo = parseInt((browserInfo + '').replace(/[^0-9.]/ig, ''))
        let MutationObserver = window.MutationObserver
        if (agent.indexOf('chrome') > 0 && verinfo >= 47 && MutationObserver !== undefined) { //
          this.$emit('getVideos', true)
        } else if (agent.indexOf('safari') > 0 && agent.indexOf('version') > 0 && MutationObserver !== undefined) {
          this.$emit('getVideos', true)
        } else {
          this.showTrackBrowser = true
        }
      },
      closeBrowser () {
        this.showTrackBrowser = false
      }
    }
  }
</script>

<style lang="stylus" scoped>
  @import "../../../../assets/common.styl"
  .icon-liulanguiji
    color $c-main
    cursor pointer
</style>